package com.start.platform.core.mappers;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.start.platform.core.entity.StartPlatformUserEntity;
import com.start.platform.core.vo.StartPlatformUserVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface StartPlatformUserMapper extends BaseMapper<StartPlatformUserEntity> {

    String PLATFORM_FANS_USER_SQL = "SELECT a.* FROM ( " +
            "SELECT " +
            " spu.*, " +
            " spf.id platform_fans_id, " +
            " platform_type, " +
            " platform_app_id, " +
            " platform_open_id  " +
            "FROM " +
            " start_platform_user spu " +
            " INNER JOIN start_platform_fans spf ON spf.platform_user_id = spu.id ) a ";

    @Select(PLATFORM_FANS_USER_SQL+" ${ew.customSqlSegment}")
    StartPlatformUserVo getUserByPlatform(Wrapper<StartPlatformUserVo> wrapper);
}
